package com.model.demo.designmodel.strategy.pay;

import java.util.HashMap;
import java.util.Map;

public class PayStrategy {
    public static final String ALIPAY="ALIPAY";
    public static final String JDPAY="JDPAY";
    public static final String UNOINPAY="UNOINPAY";

    private static Map<String,Payment> map=new HashMap<>();

    private static String DEFULT_PAY=ALIPAY;

    static{
        map.put(ALIPAY,new AliPay());
        map.put(JDPAY,new JDPay());
        map.put(UNOINPAY,new UnoinPay());
    }

    public static Payment getPayment(String payKey){
        if(!map.containsKey(payKey)){
            return map.get(ALIPAY);
        }
        return map.get(payKey);
    }

}
